<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript 逻辑 </title>
</head>
<body>
<p>所有具有“真实”值的即为 True</p>

<p id="demo"></p>

<script>
  var b1 = Boolean(100);
  var b2 = Boolean(3.14);
  var b3 = Boolean(-15);
  var b4 = Boolean("Hello");
  var b5 = Boolean('false');
  var b6 = Boolean(1 + 7 + 3.14);

  document.getElementById("demo").innerHTML =
          "100 是 " + b1 + "<br>" +
          "3.14 是 " + b2 + "<br>" +
          "-15 是 " + b3 + "<br>" +
          "任何（非空）字符串是 " + b4 + "<br>" +
          "即使字符串 'false' 也是 " + b5 + "<br>" +
          "任何表达式（除了零）是 " + b6;
</script>


</body>
</html>

<!--
运行结果：
100 是 true
3.14 是 true
-15 是 true
任何（非空）字符串是 true
即使字符串 'false' 也是 true
任何表达式（除了零）是 true
-->